/* The GTK+ renderer */

#ifndef MC_GTK_DATA_SINK_HPP
#define MC_GTK_DATA_SINK_HPP

#include <glibmm/dispatcher.h>
#include <glibmm/thread.h>

#include <memchart/types.hpp>

#include "data_sink.hpp"
#include "object_map.hpp"

namespace memchart
{
	class gtk_data_sink : public data_sink
	{
		public:

			gtk_data_sink (const object_map & objects,
				int & argc, char ** & argv);
			~gtk_data_sink ();

			void update (const string & s);

		private:

			void gui_func (int & argc, char ** & argv);

			struct thread_init
			{
				thread_init ();
			} thread_init;

			/* Data shared with MainWindow */

			Glib::Mutex       mutex;
			/* Indicates whether the main thread can continue */
			bool              can_continue;
			/* Indicates whether the GUI is still running */
			bool              gui_active;
			Glib::Cond        cond;
			Glib::Dispatcher *signal_update, *signal_quit;
			string            update_msg;

			friend class MainWindow;


			Glib::Thread     *gui_thread;
	};
}

#endif /* MC_GTK_DATA_SINK_HPP */
